package view.listeners;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import javax.swing.JMenuItem;

import model.Constants;
import view.components.IpAddressTable;
import view.dialogs.AddIpByListDialog;

public class IpAddressTablePopupListener extends MouseAdapter {

	private final IpAddressTable addressTabel;

	public IpAddressTablePopupListener(IpAddressTable addressTabel) {
		this.addressTabel = addressTabel;
	}

	@Override
	public void mousePressed(MouseEvent e) {

		JMenuItem item = (JMenuItem) e.getSource();

		if (item.getText().equalsIgnoreCase("Ip-Addresse löschen")) {
			
			addressTabel.setIpAddressEmpty(addressTabel.getSelectedIPAdress());
			

		}
		if (item.getText()
				.equalsIgnoreCase("Als active IP Addresse kenzeichen")) {
			new AddIpByListDialog(Constants.ADDIPTITLE);

		}
		
	}
}
